require 'soap/wsdlDriver'

WSDL_URL_FS = 'http://localhost:8080/Services/FS?wsdl'

soap = SOAP::WSDLDriverFactory.new(WSDL_URL_FS).create_rpc_driver
#soap.wiredump_dev = STDOUT

result = soap.sayHello({ :Name => 'tilku'})
results = soap.sayHellos({ :Names => ['sanjay', 'rajiv']})
empResult = soap.getEmployee({:EmployeeId => '1'});
p result.outName
p results.outNames
p empResult.employee.name

result = soap.giveOneGetN({})

WSDL_URL_DROP = 'http://localhost:8080/Services/DropDownOptions?wsdl'
soap = SOAP::WSDLDriverFactory.new(WSDL_URL_DROP).create_rpc_driver
results = soap.getDropDownOptions(
  {:InputList => [{:MasterCode => 'MASTER-1', :SubCode => '', 'Description' => ''},
                  {:MasterCode => 'MASTER-2', :SubCode => '', 'Description' => ''}]})
# This Ruby SOAP impl. is wasted; even if the occurance of an element is unbounded
# as long as multiple elements are not returned, the Ruby SOAP implementation does
# not treat the output as a list even though we have declared so in the contract
# A list will only be returned by the Ruby impl. if we have more than 1 elements
# as the output. For e.g. if I remove one element from the input array, "entryList"
# would no longer be an array but an object having fields "key" and "valueList"
# thereby giving us "entryList[0]" as Nil. The same with output. If the output
# is not more than two elements, "valueList[0]" gives Nil since "valueList"
# is now of type "ConfigParameter"! FAIL!
p results.dropDownOptions.entryList[0].valueList[0].subCode